<template>
  <div>
    <van-nav-bar
      title="拜访记录"
      right-text="新增"
      left-arrow
      @click-left="onClickLeft"
      @click-right="onClickRight"
    />
    <van-search v-model="value" show-action placeholder="请输入关键联系人">
      <template #action>
        <div @click="onSearch">搜索</div>
      </template>
    </van-search>
    <van-card :thumb="require('../../assets/images/合作伙伴.png')" v-for="item in arr" :key="item.id">
      <template #tags>
        <p><span>客户名称 </span>{{item.custName}}</p>
        <p><span>拜访标题 </span>{{item.visitTitle}}</p>
        <p><span>拜访时间 </span>{{item.visitTime}}</p>
        <p @click="huifang(item.id)">定期回访</p>
      </template>
    </van-card>
  </div>
</template>

<script>
import {visitList} from '../../request/api'
export default {
  data() {
    return {
      value: "",
      arr:[]
    };
  },
  methods: {
    onClickLeft() {
      this.$router.back();
    },
    onClickRight() {
      this.$router.push('/NewAdd');
    },
    onSearch() {
      this.$router.back();
    },
    huifang(id){
       this.$router.push('/Baiinfo/'+id); 
    }
  },
  created(){
    visitList({
      keyword: "",
      current: 1,
      size: 10,
    }).then(res=>{
      console.log(res.data.records)
      ;
      this.arr=res.data.records
    })
  }
};
</script>
 
<style lang = "less" scoped>
/deep/ .van-nav-bar {
  background-color: #003399;
  .van-icon {
    color: #fff;
  }
  .van-nav-bar__title {
    color: #fff;
  }
}
/deep/.van-nav-bar__right {
  .van-nav-bar__text {
    color: #fff;
  }
}
.van-search {
  margin-bottom: 10px;
}
.van-search__action {
  color: #003399;
}
.van-search__content {
  border-radius: 10px;
}
/deep/.van-card__thumb {
  width: 60px;
  height: 60px;
  background-color: #eff2f4;
  display: block;
  position: relative;
  margin-right: 11px;
}
/deep/.van-image__img {
  width: 30px;
  height: 25px;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  margin: auto;
}
/deep/.van-card {
  padding: 12px;
  background-color: #fff;
  box-sizing: border-box;
  height: 82px;
  .van-card__title {
    margin-bottom: 4px;
  }
  .van-card__desc {
    margin-bottom: 4px;
  }
  .van-card__content{
          min-height: 44px;
      p:nth-child(2){
          margin: 5px 0;
      }
      p:nth-child(4){
          position: absolute;
          top: 0;
          right: 0;
          color: orange;
          border: 1px solid orange;
          font-size: 12px;
          padding: 2px 4px;
      }
  }
}
</style>